package org.wangtian.youxueban.excel.web;


import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.wangtian.youxueban.excel.service.DpService;


/**
 * 控制器
 *
 * @author wangtian
 */
@Controller
@RequestMapping
public class Web {

    @Autowired
    private DpService dpService;


    /**
     * 上报数据
     */
    @GetMapping("/readAll")
    @ResponseBody
    public String read() {
        dpService.readAndSave();
        return JSON.toJSONString("success");
    }

    /**
     * 上报数据
     */
    @GetMapping("/read")
    @ResponseBody
    public String read(String from, String to) {
        //健康打卡（正式）_2020-10-16.xlsx
        dpService.readAndSave(from, to);
        return JSON.toJSONString("success");
    }


}
